<template>
  <div class="item">
    <div class="item_top">
      <div class="item_top_left">
        <img :src="icon"
             class="icon">
        <div class="split" :style="{backgroundColor: useStatusColor(item.status)}"></div>
        <div class="name">{{item.name}}</div>
      </div>
      <i v-if="showDelete"
         @click="$emit('handleDelete',item.myId)"
         class="cuifont icon_delete cursor-pointer"></i>
    </div>
    <div class="item_bottom">{{item.description}}</div>
  </div>
</template>

<script>
import useStatusColor from '@/components/storybook/hooks/useStatusColor'
export default {
  data () {
    return {
      icon: window.SITE_CONFIG['ossAddressURL'] + '/app/mspbots_theme_icon/crud_form.png'
    }
  },
  props: {
    item: {
      type: Object,
      default: () => {

      }
    },
    showDelete: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    useStatusColor
  }

}
</script>

<style lang="scss" scoped>
.item {
  height: 60px;
  &_top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    &_left {
      display: flex;
      align-items: center;
      .icon {
        width: 24px;
        height: 24px;
      }
      .split {
        width: 4px;
        height: 14px;
        border-radius: 1px;
        margin: 0 8px 0 16px;
        background-color: rgb(19, 141, 199);
      }
      .name {
        font-size: 18px;
        color: #404040;
        font-weight: 600;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        max-width: 300px;
      }
    }
  }
  &_bottom {
    font-size: 14px;
    color: #7f7f7f;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 500px;
  }
}
</style>
